package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "9021000136609921";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDJfkuetdY80aIHjgNPC2bJgwR/bitQn66fSOHEXwXs9RTtVEEmOXVBe3145O16o101560W4jqbI5UhLWfKVFyxBRJA0FmOBBsC8M9kfWe8DRcxU9NecTRSQ9d+WFYPwFs2I26weYiS6p0SKahJzhj/J1XqwcbYlKyiKLHmxR7p0Vqceh6Rrc5CQBQ7816ApOB+OQZRIyJ8YDRc4sVrMi7n8hQjlznHJGy+la2rw3+X8IljNIwikBja27wwt8hg+FrJFaj4IgddvSN3298hPDnQGYc3/L2oquFWtr/9sh5FF/avPSLCLZpw3oofzkb4W1vrg2Le9hw2vJSoMtUYnqudAgMBAAECggEAI2Mw+MDKzYerw1PntNw1wzJledPpe5Fv472zGP/vVHx+nmfrwUDaHRQJJ1BdfOpwFmWH+rrkvBZ1vIvy7JAAb36KhCOTduO1ssCETAvSSi6qYhlsx+tt2vzbPe9Zvg50dn+mkwvlNphJ2cTDL6MotLc92asKt0L1Rs2K4RLBqSKxUdOkNt2Q7tiErTpqAb3J9zDiQpnUK+1/Y5rEqNrAr75MhmOuBaaqS3DJ6OiGvFjPGyz+Zb8+2ttXIC0ioYuPbzwx4iafO8Augluxc/g8Guotp+TbL+DqFcWS0+Bl+DHrt8DyER9rQji20Kku9qrSQXYSQpJdiN+gK9fG2LWkQQKBgQD+hJSx0YPkm49iMmxVnq6d3qvJh4XV66a1dgbjTwxLlvqvcjRac6kv8DS7JbR+wPCWLUdR9lS2pXrhvVOGvfvxNnp7MQzn29Axng5GWShlpzqrEJ9mnNddVlxBr7xsP+J6uLOlcZXYgwJQeb+ZiG5/2qbUwHB0fgLMQapdaCWYZQKBgQDKqqs9dDEI0xi1HLhLYaIEDusb4a2EqfQvHoD0ORM3HH+6WhscruD4s0OxI+tV9gO+RrHOr2uiZTF6sIFrWL1QSeJ11SC/MYNhcmAg0XhnPVOSIeG99rHMXCyS0s2qAA0j2W4uT7buglhmGeQo+FCouePP5TbIyhfAlVSVv8Om2QKBgQCKn82ZOEM9DVlAI7SLwbzbsX8hadYEWLBZH2rK/a/1r8rkKjDHnz1kJdGiqPuxGgcv1IOG6cLkJCdUsli/B9UkYQa++E1OL5QqoiqmOENfcoDq0UfwjLZkWPgwsrXOw9DoBJecIcx6u4hUKqunxP5iVsYNFK9rU4LUm2NeMq5fXQKBgHhzvTjWIPqUtD+YZTRwP6HX2AaHN+D8PePvZkdA0NnVd1ijiy+eBJnruZTDu3AouorRa4ZjHj6zlBfOZe0OHd5lO1I7LK5V2DcHiniW5s+9VDkrKAcGYyAJvHg7D/807ppa9TBTMm9JSw7L3p43D4FokiySl9/4tOtCFba29arpAoGBAP5veb7eFZypBANHeHk3eYixPWTccGOJccuOySnna3K25M6Xq+noAB8cpuRnSPx0T5QewbFZ2MhlCbShxbZz1+cu8IhlUVnEmG+U4goJsPBokYAwVhDS7sVn7WJdyBYQSmp3Tj3UWmw3kXdPanbiPa+3CIkUm6lOUg9K7m7wuQDj";
    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAh1Ek/aeSqokHtHvc8hfjDhhumA9aG3JppdJa+FNY37TQ3EfMep0pArrC3nnZAqfZenhS2T1NsdcVqVd11MOjqCHAjfXYXhhy5t5o5uqA13du1k4091aZl6GHNM6nlo9e0MP286ubycBsBrqP/blceFoTnwnhBwgGTN9m1IMmTdQOA7J1KxjYLwC8eVN+95LkcrWQNtfOddxzm28zcZzMtQA2io1BvwL2gY5CEJmGVCwK/sM7/Fu0UOWFMJb/Fu3rZGIoVMWMNp4Lpy6R/ikonnx1XQp27HP+HkkreTOr0gnjGd9wL3VLhSrx0z29t8cgsOua3IrsqxFq7k44Sf5tZQIDAQAB";
    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:8091/testWeb01/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8091/testWeb01/return_url.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi-sandbox.dl.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

